"""Added new columns to product

Revision ID: e569739c3d35
Revises: e5f9a2218813
Create Date: 2024-05-24 23:52:16.937001

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "e569739c3d35"
down_revision = "e5f9a2218813"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("product", sa.Column("cost_to_business", sa.Float(), nullable=True))
    op.add_column("product", sa.Column("realise_price", sa.Float(), nullable=True))
    op.add_column(
        "product", sa.Column("sync_with_loyverse", sa.Boolean(), server_default=sa.text("false"), nullable=False)
    )
    op.add_column(
        "product", sa.Column("sync_stock_with_loyverse", sa.Boolean(), server_default=sa.text("false"), nullable=False)
    )
    op.add_column("product", sa.Column("sku", sa.UUID(), nullable=True))
    op.create_unique_constraint(op.f("uq_product_sku"), "product", ["sku"])
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(op.f("uq_product_sku"), "product", type_="unique")
    op.drop_column("product", "sku")
    op.drop_column("product", "sync_stock_with_loyverse")
    op.drop_column("product", "sync_with_loyverse")
    op.drop_column("product", "realise_price")
    op.drop_column("product", "cost_to_business")
    # ### end Alembic commands ###
